/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bis;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Administrator
 */
public class FLBookClassMgr extends FLBaseMgr {

    private ArrayList GetDate() {
        ArrayList list = new ArrayList();
        ResultSet rs = super.Query();
        try {
            while (rs.next()) {
                FLBookClass flb = null;
                try {
                    flb = new FLBookClass(rs.getString(1), rs.getString(2));
                } catch (SQLException ex) {
                    Logger.getLogger(FLBookClassMgr.class.getName()).log(Level.SEVERE, null, ex);
                }
                list.add(flb);
            }
        } catch (SQLException ex) {
            Logger.getLogger(FLBookClassMgr.class.getName()).log(Level.SEVERE, null, ex);
        }
        return list;
    }

    public ArrayList GetDateById(String id) {
        QueryStr = "select * from tblLx where Bm='" + id + "'";
        return GetDate();
    }

    public ArrayList GetAllDate() {
        QueryStr = "select * from tblLx";
        return GetDate();
    }

    public void flcdelete(String bm) {
        this.bm = bm;
        this.BaseDelete();

    }

    public void setUpdate(FLBookClass flbc) {
        QueryStr = "select * from tblLx where Bm='" + flbc.bm + "'";
        UpdateStr = "update tblLx set mc='" + flbc.mc + "' where Bm='" + flbc.bm + "'";
        super.BaseUpdate();
    }

    @Override
    public void BaseDelete() {
        QueryStr = "select bm from tblLx where Bm='" + bm + "'";
        UpdateStr = "delete from tblLx where Bm='" + bm + "'";
        super.BaseDelete();
    }

    public boolean Insert(FLBookClass bc) {
        String c = "insert into tblLx(Bm, mc) values('" + bc.bm + "','" + bc.mc + "')";
        this.InsertStr = c;
        return super.Insert();
    }
}
